# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.SQLAdmin.V1beta4.Model.ReplicationCluster do
  @moduledoc """
  A primary instance and disaster recovery (DR) replica pair. A DR replica is a cross-region replica that you designate for failover in the event that the primary instance has regional failure. Applicable to MySQL and PostgreSQL.

  ## Attributes

  *   `drReplica` (*type:* `boolean()`, *default:* `nil`) - Output only. Read-only field that indicates whether the replica is a DR replica. This field is not set if the instance is a primary instance.
  *   `failoverDrReplicaName` (*type:* `String.t`, *default:* `nil`) - Optional. If the instance is a primary instance, then this field identifies the disaster recovery (DR) replica. A DR replica is an optional configuration for Enterprise Plus edition instances. If the instance is a read replica, then the field is not set. Set this field to a replica name to designate a DR replica for a primary instance. Remove the replica name to remove the DR replica designation.
  *   `psaWriteEndpoint` (*type:* `String.t`, *default:* `nil`) - Output only. If set, this field indicates this instance has a private service access (PSA) DNS endpoint that is pointing to the primary instance of the cluster. If this instance is the primary, then the DNS endpoint points to this instance. After a switchover or replica failover operation, this DNS endpoint points to the promoted instance. This is a read-only field, returned to the user as information. This field can exist even if a standalone instance doesn't have a DR replica yet or the DR replica is deleted.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :drReplica => boolean() | nil,
          :failoverDrReplicaName => String.t() | nil,
          :psaWriteEndpoint => String.t() | nil
        }

  field(:drReplica)
  field(:failoverDrReplicaName)
  field(:psaWriteEndpoint)
end

defimpl Poison.Decoder, for: GoogleApi.SQLAdmin.V1beta4.Model.ReplicationCluster do
  def decode(value, options) do
    GoogleApi.SQLAdmin.V1beta4.Model.ReplicationCluster.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.SQLAdmin.V1beta4.Model.ReplicationCluster do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
